home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / dev / lang / SmallEiffel.lha / SmallEiffel / lib_rand / demo1.e next >
Text File  |  1998-12-22  |  1KB  |  51 lines

  1. -- This file is  free  software, which  comes  along  with  SmallEiffel. This
  2. -- software  is  distributed  in the hope that it will be useful, but WITHOUT 
  3. -- ANY  WARRANTY;  without  even  the  implied warranty of MERCHANTABILITY or
  4. -- FITNESS  FOR A PARTICULAR PURPOSE. You can modify it as you want, provided
  5. -- this header is kept unaltered, and a notification of the changes is added.
  6. -- You  are  allowed  to  redistribute  it and sell it, alone or as a part of 
  7. -- another product.
  8. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  9. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  10. --                       http://www.loria.fr/SmallEiffel
  11. --
  12. class DEMO1
  13.  
  14. creation make 
  15.  
  16. feature
  17.  
  18.    make is
  19.       local
  20.      std_rand: MIN_STAND;
  21.      count, range, column: INTEGER;
  22.       do
  23.      io.put_string("Using the MIN_STAND random number generator.%N%
  24.                %How many numbers ? ");
  25.      io.read_integer;
  26.      count := io.last_integer;
  27.      io.put_string("Range ( > 1)     ? ");
  28.      io.read_integer;
  29.      range := io.last_integer;
  30.      from
  31.         !!std_rand.make;
  32.      until
  33.         count = 0
  34.      loop
  35.         std_rand.next;
  36.         io.put_integer(std_rand.last_integer(range));
  37.         count := count - 1;
  38.         if column = 6 then
  39.            io.put_string("%N");
  40.            column := 0;
  41.         else
  42.            column := column + 1;
  43.            io.put_string("%T");
  44.         end;
  45.      end;
  46.      io.put_string("%N");
  47.       end;
  48.  
  49. end -- DEMO1
  50.  
  51.